import bpy

import 全局控制.Node.节点和插座基类.bl_节点基类 as 基类
import 节点.Core.bl_UI配色 as 配色

import engine.initLIB.load_dll as engineLib
import ctypes




engineLib.flexCAPI.f_创建计算F32Array2D_总合节点.restype = ctypes.c_bool








class C_Node_计算标量数组总合(基类.C_Node_基类): 
	bl_label = '计算标量数组总合'
	bl_dname = 'bl_node_计算标量数组总合'
	
	def init(self, context):
		super(C_Node_计算标量数组总合, self).f_init(context)
		self.inputs.new('C_Socket_F32_Array1D', name='源')
		self.outputs.new('C_Socket_F32_Array1D', name='var')
		self.f_toCPP()
		
	def f_toCPP(self):
		engineLib.flexCAPI.f_创建循环节点(ctypes.c_wchar_p(self.id_data.name), ctypes.c_wchar_p(self.name), self.f_getPyObject());
		

class C_NODE_AddMenu_计算标量数组总合(bpy.types.Operator):
	bl_idname = 'node.global_node_f32_a1_total'
	bl_label = '计算标量数组总合'
	bl_options = {'REGISTER', 'UNDO'}
	def execute(operator, context):
		node = bpy.ops.node.add_node(type='C_Node_计算标量数组总合', use_transform=True)
		return {'FINISHED'}













class C_Node_计算F32Array2D_总合(基类.C_Node_基类): 
	bl_label = 'F32Array2D_总合'
	bl_dname = 'bl_node_F32Array2D_总合'
	
	def init(self, context):
		super(C_Node_计算F32Array2D_总合, self).f_init(context)
		self.inputs.new('C_Socket_F32_Array2D', name='源')
		self.outputs.new('C_Socket_F32_Array1D', name='var')

		self.use_custom_color = True
		self.color = UI配色.g_内部节点颜色
		self.f_toCPP()
		
	def f_toCPP(self):
		engineLib.flexCAPI.f_创建计算F32Array2D_总合节点(ctypes.c_wchar_p(self.id_data.name), ctypes.c_wchar_p(self.name), self.f_getPyObject());
		

class C_NODE_AddMenu_计算F32Array2D_总合(bpy.types.Operator):
	bl_idname = 'node.global_node_f32_a2_total'
	bl_label = 'F32Array2D_总合'
	bl_options = {'REGISTER', 'UNDO'}
	def execute(operator, context):
		node = bpy.ops.node.add_node(type='C_Node_计算F32Array2D_总合', use_transform=True)
		return {'FINISHED'}









classes = (
	C_Node_计算标量数组总合,
	C_NODE_AddMenu_计算标量数组总合,


	C_Node_计算F32Array2D_总合,
	C_NODE_AddMenu_计算F32Array2D_总合,

)

def register():
	for c in classes:
		bpy.utils.register_class(c)
		
def unregister():
	for c in classes:
		bpy.utils.unregister_class(c)

	


